<?php
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/factory/DaoFactory.php';
	
	error_reporting (E_ALL ^ E_NOTICE);
	
	$debug = $_SESSION['debug'];
	
	/*
	* Class to select all existing requests
	*/
	class CommandSelectRequests extends CustomCommand {
		/*
		 * Constructor of the class
		 */
		public function __construct($order) {
			$this -> orderType = $order;	
		}
		
		/*
		 * Method to execute to select all existing requests
		 */
		public function execute() {
			$daoFactory = DaoFactory :: getMySqlDaoFactory();
			$irad = $daoFactory -> getMySqlRequestAccessDao();			
			$sentence = $irad -> selectRequests($this -> orderType);
			
			$requests = ''; $i = 0;
			while ($row = mysql_fetch_array($sentence)) {
				$requests['pk_number'][$i] = $row['pk_number'];
				$requests['pk_control_number'][$i] = $row['pk_control_number'];
				$requests['date'][$i] = $row['date'];
				$requests['tax'][$i] = $row['tax'];
				$requests['client'][$i] = $row['client'];
				$requests['read_status'][$i++] = $row['read_status'];
			}			
			
			$this -> result = $requests;
		}
	}
?>